﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class CameraController : MonoBehaviour
{

	public Transform target;

	public Vector3 offset;
	public float moveSpeed;

	private void Start() {
		// float x = Mathf.Lerp(1, 3, 0.1f);
		// Debug.Log(x);   // x = 1 + (3 - 1) * 0.1;
		// x = from + (to - from) * t;

	}

	private void Update() {
		// Vector3 oX = transform.position - target.position;
		// Debug.Log(oX);


		Vector3 pos = new Vector3(
			target.position.x + offset.x,
			target.position.y + offset.y,
			transform.position.z
		);
		transform.position = Vector3.Lerp(transform.position, pos, Time.deltaTime * moveSpeed);

	}


}
